package com.hutu.erp.catalog.service.impl;

import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hutu.erp.catalog.mapper.SpecificationMapper;
import com.hutu.erp.catalog.domain.Specification;
import com.hutu.erp.catalog.service.ISpecificationService;

/**
 * 商品参数Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-05-11
 */
@Service
public class SpecificationServiceImpl implements ISpecificationService 
{
    @Autowired
    private SpecificationMapper specificationMapper;

    /**
     * 查询商品参数
     * 
     * @param specificationId 商品参数ID
     * @return 商品参数
     */
    @Override
    public Specification selectSpecificationById(Long specificationId)
    {
        return specificationMapper.selectSpecificationById(specificationId);
    }

    /**
     * 查询商品参数列表
     * 
     * @param specification 商品参数
     * @return 商品参数
     */
    @Override
    public List<Specification> selectSpecificationList(Specification specification)
    {
        return specificationMapper.selectSpecificationList(specification);
    }

    /**
     * 新增商品参数
     * 
     * @param specification 商品参数
     * @return 结果
     */
    @Override
    public int insertSpecification(Specification specification)
    {
        System.out.println("输出一下 category，查看一下页面上采集到的数据。");
        System.out.println(specification);
        specification.setCreatedBy(SecurityUtils.getUsername());
        specification.setUpdatedBy(SecurityUtils.getUsername());

        return specificationMapper.insertSpecification(specification);
    }

    /**
     * 修改商品参数
     * 
     * @param specification 商品参数
     * @return 结果
     */
    @Override
    public int updateSpecification(Specification specification)
    {


        System.out.println("输出一下 specification，查看一下页面上采集到的数据。");
        System.out.println(specification);
        specification.setUpdatedBy(SecurityUtils.getUsername());

        return specificationMapper.updateSpecification(specification);
    }

    /**
     * 批量删除商品参数
     * 
     * @param specificationIds 需要删除的商品参数ID
     * @return 结果
     */
    @Override
    public int deleteSpecificationByIds(Long[] specificationIds)
    {
        return specificationMapper.deleteSpecificationByIds(specificationIds);
    }

    /**
     * 删除商品参数信息
     * 
     * @param specificationId 商品参数ID
     * @return 结果
     */
    @Override
    public int deleteSpecificationById(Long specificationId)
    {
        return specificationMapper.deleteSpecificationById(specificationId);
    }
}
